/*     */ package com.lmpop.trade.ti_newschannel;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_newschannelInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_newschannelInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_newschannel ti_newschannel = new Ti_newschannel();
/*  27 */     ti_newschannel.setCh_id(map.getString("ch_id"));
/*  28 */     ti_newschannel.setCust_id(map.getString("session_cust_id"));
/*  29 */     ti_newschannel.setCh_name(map.getString("ch_name"));
/*  30 */     ti_newschannel.setUp_ch_id(map.getString("up_ch_id"));
/*  31 */     ti_newschannel.setCh_level(map.getString("ch_level"));
/*  32 */     ti_newschannel.setRemark(map.getString("remark"));
/*     */ 
/*  34 */     String result_code = "0";
/*     */     try {
/*  36 */       insert(dbmMgr, ti_newschannel);
/*     */     } catch (ApplicationException e) {
/*  38 */       e.printStackTrace();
/*  39 */       result_code = "1";
/*     */     }
/*  41 */     map.setString("result_code", result_code);
/*  42 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_newschannel ti_newschannel)
/*     */     throws ApplicationException
/*     */   {
/*  51 */     dbmMgr.update("insertTi_newschannel", ti_newschannel);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  61 */     String pkid_string = map.getString("pkid");
/*  62 */     String result_code = "0";
/*     */     try {
/*  64 */       if (!pkid_string.equals("")) {
/*  65 */         String[] pkStr = pkid_string.split("\\|");
/*  66 */         for (int i = 0; i < pkStr.length; i++) {
/*  67 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  71 */       e.printStackTrace();
/*  72 */       result_code = "1";
/*     */     }
/*  74 */     map.setString("result_code", result_code);
/*  75 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  84 */     dbmMgr.update("deleteTi_newschannel", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  94 */     Ti_newschannel ti_newschannel = new Ti_newschannel();
/*  95 */     ti_newschannel.setCh_id(map.getString("ch_id"));
/*  96 */     ti_newschannel.setCust_id(map.getString("session_cust_id"));
/*  97 */     ti_newschannel.setCh_name(map.getString("ch_name"));
/*  98 */     ti_newschannel.setUp_ch_id(map.getString("up_ch_id"));
/*  99 */     ti_newschannel.setCh_level(map.getString("ch_level"));
/* 100 */     ti_newschannel.setRemark(map.getString("remark"));
/* 101 */     String result_code = "0";
/*     */     try {
/* 103 */       update(dbmMgr, ti_newschannel);
/*     */     } catch (ApplicationException e) {
/* 105 */       e.printStackTrace();
/* 106 */       result_code = "1";
/*     */     }
/* 108 */     map.setString("result_code", result_code);
/* 109 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_newschannel ti_newschannel)
/*     */     throws ApplicationException
/*     */   {
/* 118 */     dbmMgr.update("updateTi_newschannel", ti_newschannel);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 129 */     Map ti_newschannel = (Hashtable)obj;
/* 130 */     if (start == 0)
/* 131 */       start = 0;
/*     */     else {
/* 133 */       start = (start - 1) * limit;
/*     */     }
/*     */ 
/* 136 */     ti_newschannel.put("start", Integer.valueOf(start));
/* 137 */     ti_newschannel.put("limit", Integer.valueOf(limit));
/*     */ 
/* 139 */     return this.queryList.getList("getListByTi_newschannelPage", ti_newschannel);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 151 */     Map ti_newschannel = (Hashtable)obj;
/* 152 */     List list = this.queryList.getList("getCountByObjTi_newschannel", ti_newschannel);
/* 153 */     int count = 0;
/* 154 */     if ((list != null) && (list.size() > 0)) {
/* 155 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 156 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 157 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 160 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 170 */     return this.queryList.getList("getTi_newschannelByPk", pk);
/*     */   }
/*     */ 
/*     */   public int checkSonById(String pk)
/*     */   {
/* 181 */     List catList = this.queryList.getList("check_channel_Son", pk);
/* 182 */     if ((catList != null) && (catList.size() > 0)) {
/* 183 */       return 1;
/*     */     }
/* 185 */     return 0;
/*     */   }
/*     */ 
/*     */   public String getChNameById(String ch_id)
/*     */   {
/* 196 */     List chList = this.queryList.getList("get_ChName_Id", ch_id);
/* 197 */     String ch_name = "";
/* 198 */     Hashtable chMap = new Hashtable();
/* 199 */     if ((chList != null) && (chList.size() > 0)) {
/* 200 */       chMap = (Hashtable)chList.get(0);
/* 201 */       if (chMap.get("ch_name") != null)
/* 202 */         ch_name = chMap.get("ch_name").toString();
/*     */     }
/* 204 */     return ch_name;
/*     */   }
/*     */ 
/*     */   public String getUp_ch_id(String ch_id)
/*     */   {
/* 215 */     List chList = this.queryList.getList("getUpch_id", ch_id);
/* 216 */     String up_ch_id = "";
/* 217 */     Hashtable chMap = new Hashtable();
/* 218 */     if ((chList != null) && (chList.size() > 0)) {
/* 219 */       chMap = (Hashtable)chList.get(0);
/* 220 */       if (chMap.get("up_ch_id") != null)
/* 221 */         up_ch_id = chMap.get("up_ch_id").toString();
/*     */     }
/* 223 */     return up_ch_id;
/*     */   }
/*     */ 
/*     */   public String getChannelByLevel(String level)
/*     */   {
/* 234 */     List list = this.queryList.getList("getChannel_Level", level);
/*     */ 
/* 236 */     String select = "";
/* 237 */     if ((list != null) && (list.size() > 0)) {
/* 238 */       for (int i = 0; i < list.size(); i++) {
/* 239 */         Hashtable map = (Hashtable)list.get(i);
/* 240 */         String id = ""; String text = "";
/* 241 */         if (map.get("ch_id") != null) {
/* 242 */           id = map.get("ch_id").toString();
/*     */         }
/* 244 */         if (map.get("ch_name") != null) {
/* 245 */           text = map.get("ch_name").toString();
/*     */         }
/* 247 */         select = select + "<option value=" + id + ">" + text + "</option>";
/*     */       }
/*     */     }
/* 250 */     return select;
/*     */   }
/*     */ 
/*     */   public Map getClassByUpId(String up_ch_id)
/*     */   {
/* 261 */     Map classMap = new Hashtable();
/* 262 */     String ch_id = ""; String ch_name = "";
/* 263 */     List list = this.queryList.getList("check_channel_Son", up_ch_id);
/* 264 */     if ((list != null) && (list.size() > 0)) {
/* 265 */       for (int i = 0; i < list.size(); i++) {
/* 266 */         Hashtable map = (Hashtable)list.get(i);
/* 267 */         if (map.get("ch_name") != null) {
/* 268 */           ch_name = map.get("ch_name").toString();
/*     */         }
/* 270 */         if (map.get("ch_id") != null) {
/* 271 */           ch_id = map.get("ch_id").toString();
/*     */         }
/* 273 */         classMap.put(ch_id, ch_name);
/*     */       }
/*     */     }
/* 276 */     return classMap;
/*     */   }
/*     */ 
/*     */   public Map getAllNewsChClass()
/*     */   {
/* 288 */     Ti_newschannel ti_channel = new Ti_newschannel();
/* 289 */     Map classMap = new Hashtable();
/* 290 */     String class_id = ""; String class_name = "";
/* 291 */     List list = this.queryList.getList("getAllChannel", ti_channel);
/* 292 */     if ((list != null) && (list.size() > 0)) {
/* 293 */       for (int i = 0; i < list.size(); i++) {
/* 294 */         Hashtable map = (Hashtable)list.get(i);
/* 295 */         if (map.get("ch_name") != null) {
/* 296 */           class_name = map.get("ch_name").toString();
/*     */         }
/* 298 */         if (map.get("ch_id") != null) {
/* 299 */           class_id = map.get("ch_id").toString();
/*     */         }
/* 301 */         classMap.put(class_id, class_name);
/*     */       }
/*     */     }
/* 304 */     return classMap;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_newschannel.Ti_newschannelInfo
 * JD-Core Version:    0.6.0
 */